/**
 * 
 */
package com.wolfware.athsweb.factory.impl;

import java.util.Date;
import java.util.List;

import com.wolfware.athsweb.domain.AbstractEvent;
import com.wolfware.athsweb.domain.Competition;
import com.wolfware.athsweb.factory.CompetitionFactory;
import com.wolfware.athsweb.factory.helper.FactoryHelper;

/**
 * @author ChristianStrzadala
 *
 */
public class CompetitionFactoryImpl implements CompetitionFactory {

	/**
	 * {@inheritDoc}
	 */
	public Competition createCompetition(String compName, Date compDate, List<AbstractEvent> compEventList) {
		Competition competition = new Competition();
		
		competition.setDate(compDate);
		competition.setEventList(compEventList);
		competition.setName(compName);
		
		competition.setDescription(FactoryHelper.deriveCompetitionDescription(compName, compDate));
		
		return competition;
	}
	
	/**
	 * {@inheritDoc}
	 */
	public Competition createCompetition(String compName, Date compDate, AbstractEvent compEvent) {
		Competition competition = new Competition();
		
		competition.setDate(compDate);
		competition.setName(compName);
		
		competition.setDescription(FactoryHelper.deriveCompetitionDescription(compName, compDate));
		
		competition.addEvent(compEvent);
		
		return competition;
	}

}
